#include "stdafx.h"
#include "game~.h"

game:: game(){}	
game::~game(){}	

void game::dmap()
{
	mdc->BitBlt(0,0,WIDTH,HEIGHT,map,DP*s.x,DP*s.y,SRCCOPY);
}

void game::dman()
{
	cc.Format("%s/res/man.bmp",dir);
	getpic(cc);
	TransparentBlt2(*mdc,DP*(man.x-s.x),DP*(man.y-s.y),DP,DP,*mdc1,DP*t,DP*d,DP,DP,RGB(255,255,255));
}

void game::dmon()
{
	cc.Format("%s/res/snake.bmp",dir);
	getpic(cc);
	TransparentBlt2(*mdc,DP*(mon.x-s.x),DP*(mon.y-s.y),DP,DP,*mdc1,0,0,DP,DP,RGB(255,255,255));
}

void game::changemap()
{
	if(n==1 && man.x==13 && man.y==14)
		{changing();n++;loadmap();man.x=2;man.y=1;chmap=false;}
	if(n==2 && man.x==2 && man.y==0)
		{changing();n--;loadmap();man.x=13;man.y=13;chmap=false;}
}

void game::changing()
{
	chmap=true;
	Sleep(300);
}

void game::monster()
{
	meetmonster=0;
	count=0;
	if(n==2)
	{	
//		if(rand()%3==0)AfxMessageBox("monster A occur");
//		else if(rand()%3==1)AfxMessageBox("monster B occur");
//		else AfxMessageBox("monster C occur");
		if(rand()%3==0){ch="monster A occur";len=strlen(ch);ii=0;tout=true;}
		else if(rand()%3==1){ch="monster B occur";len=strlen(ch);ii=0;tout=true;}
		else {ch="monster C occur";len=strlen(ch);ii=0;tout=true;}
	}
}